import oss2
import datetime
# # 使用requests库上传文件
import requests


# 填写你的AccessKeyId和AccessKeySecret
auth = oss2.Auth('LTAI5tBWSfGYWw9cveErF9iU', 'eUPnw9SrEgFpbxyZDBKfYckToZuAQN')
# 填写Bucket信息
bucket = oss2.Bucket(auth, 'https://oss-cn-beijing.aliyuncs.com', 'zddsc')

# 要上传的文件名
object_name = 'bbc.txt'
# 本地文件路径
file_path = './bbc.txt'

# 生成请求
url = bucket.sign_url('PUT', object_name, 60)

print(url)

#
# with open(file_path, 'rb') as fileobj:
#     requests.put(url, data=fileobj)
#
# print(f'File uploaded to {object_name}')